﻿/**
* @description	Class for drawing a solide colored rectangle.
*/	
package com.foed.graphic.skins {

	public class SimpleRect extends Skin {
		
		/**
		* @description	Draws the face of the component.
		*/	
		protected function drawFace():void {
			if (_formatChanged || _sizeChanged || _stateChanged) {
				var pColor:uint;
				switch (_state) {
					case SkinStates.OVER:
						pColor = _styleFormat.getProperty("rolloverFace") as uint;
						break;
					case SkinStates.DOWN:
						pColor = _styleFormat.getProperty("selectedFace") as uint;
						break;
					default:
						pColor = _styleFormat.getProperty("face") as uint;
						break;
				}
				graphics.clear();
				graphics.beginFill(pColor, 1);
				graphics.drawRect(0, 0, _width, _height);
				graphics.endFill();
			}
		}
	
		/**
		* @description	Draws graphics in the skin, then resets flags.
		*/	
		override protected function redraw():void {
			drawFace();
			super.redraw();
		}

	}

}